layui.use(['layer','form','table','element','layedit','upload','laydate'],function () {
    var layer = layui.layer
        ,form = layui.form
        ,table =layui.table
        ,element = layui.element
        ,layedit = layui.layedit
        ,laydate  = layui.laydate
        ,upload = layui.upload;

    $.ajax({
        url:"/admin/getDriverList"
        ,type:"POST"
        ,success:function (res) {
            var driverList = res.data.drivers;
            $("#owner").empty();
            $.each(driverList,function (i,item) {
                $("#owner").append("<option value='"+item.id+"'>"+item.userName+"</option>");
                form.render();
            });

            var ownerId = $("#ownerId").val();
            $("#owner").val(ownerId);
            form.render();
        }
        ,error:function () {
            layer.msg("系统错误！");
        }
    });
    
    
    $("#send").bind("click",function () {

        $.ajax({
            type:"POST"
            ,url:"/admin/sendSingtonCost"
            ,data:{
                "costName":$("#costName").val()
                ,"owner":$("#owner").val()
            }
            ,success:function (res) {
                layer.msg(res.message);
            }
            ,error:function () {
                layer.msg("系统错误！");
            }
        });

    })

});